package org.hzdl.goods.controller;

import org.hzdl.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    //查询所以商品
    @RequestMapping("all")
    public Object all() {
        return goodsService.findAll();
    }

    //根据id查询商品
    @RequestMapping("one")
    public Object one(Integer id) {
        return goodsService.findById(id);
    }
}